package com.lagou.work.workthree;

/*
 * 上网套餐类
 * */
public class InternetAccessPac extends PricingPac implements InternetSer {

    //上网流量
    private int traffic;
//    //每月资费
//    private double monthCharge;

    public InternetAccessPac() {
        super();
    }

    public InternetAccessPac(int traffic, double monthCharge) {
        super(monthCharge);
        setTraffic(traffic);
    }

    public int getTraffic() {
        return traffic;
    }

    public void setTraffic(int traffic) {
        this.traffic = traffic;
    }

//    public double getMonthCharge() {
//        return monthCharge;
//    }
//
//    public void setMonthCharge(double monthCharge) {
//        this.monthCharge = monthCharge;
//    }

//    public void show(InternetAccessPac[] accessPacs){
//        for (int i = 0; i < accessPacs.length; i++) {
//            System.out.println("上网流量:" + accessPacs[i].getTraffic() + ",每月资费:" + accessPacs[i].getMonthCharge());
//        }
//    }

    @Override
    public void show() {
        System.out.println("上网流量:" + getTraffic() + ",每月资费:" + getMonthCharge());
    }

    @Override
    public void online(int traffic, PhoneCard phoneCard) {
        //调用电话卡的show方法，展示对应的信息
        phoneCard.show();
        //展示当前套餐的信息
        show();
        System.out.println(phoneCard.getUserName() + "上网使用了" + traffic + "M流量");
    }
}
